import * as THREE from 'three';
import { GLTFLoader } from 'three/addons/loaders/GLTFLoader.js';
const model = new THREE.Group();
const loader = new GLTFLoader()
const gltf = await loader.loadAsync('/士兵.glb')
const player = gltf.scene
model.add(player)
let mixer = null
//包含关键帧动画的模型对象作为AnimationMixer的参数创建一个播放器mixer
mixer = new THREE.AnimationMixer(model);
//AnimationMixer的`.clipAction()`返回一个AnimationAction对象
const clipAction = mixer.clipAction(gltf.animations[1]); 
clipAction.play();  
mixer.timeScale = 0
const clock = new THREE.Clock();
function loop() {
    requestAnimationFrame(loop);
    //clock.getDelta()方法获得loop()两次执行时间间隔
    const frameT = clock.getDelta()
    mixer.update(frameT)
}
loop();
export default {model,player,mixer};